//
//  BueinessPhotoController.m
//  LiquorChain
//
//  Created by apple on 2019/1/5.
//  Copyright © 2019年 王冬. All rights reserved.
//

#import "BueinessPhotoController.h"
#import "BusinessViewCell.h"
@interface BueinessPhotoController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UITableView *tableView;
@property (nonatomic,strong) NSArray *titleArry;
@end

@implementation BueinessPhotoController
static NSString *CellIdentifier = @"businessCell";
-(NSArray *)titleArry{
    if (!_titleArry) {
        _titleArry =[NSArray array];
    }
    return _titleArry;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"商家入驻申请";
    self.view.backgroundColor = [UIColor whiteColor];
    self.titleArry = @[@"营业执照",@"身份证正面",@"身份证反面",@"手持身份证照"];
   
    self.tableView =[[UITableView alloc]initWithFrame:CGRectMake(0, kNavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-kNavBarHeight-kIPhoneXBottomHeight) style:UITableViewStyleGrouped];
    self.tableView.backgroundColor =[UIColor whiteColor];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  //  [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CellIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:@"BusinessViewCell" bundle:nil] forCellReuseIdentifier:CellIdentifier];
    [self.view addSubview:self.tableView];
    [self creatHeadView];

    // Do any additional setup after loading the view.
}
-(void)creatHeadView{
    
    UIView *headView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 120)];
    UILabel *titleLabel =[[UILabel alloc]init];
    [headView addSubview:titleLabel];
    titleLabel.text = @"上传资料";
    titleLabel.font =[UIFont systemFontOfSize:25];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(15);
        make.height.mas_equalTo(30);
    }];
    UILabel *infoLabel =[[UILabel alloc]init];
    [headView addSubview:infoLabel];
    infoLabel.text = @"快速定位 精细做事";
    infoLabel.font =[UIFont systemFontOfSize:12];
    [infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(titleLabel.mas_bottom).with.offset(10);
        make.left.mas_equalTo(15);
        make.height.mas_equalTo(12);
    }];
    self.tableView.tableHeaderView = headView;
    UIView *bottomView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 80)];
    
    UIButton *commitbtn =[UIButton buttonWithType:UIButtonTypeCustom];
    [bottomView addSubview:commitbtn];
    [commitbtn setTitle:@"确认" forState:UIControlStateNormal];
    [commitbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    commitbtn.layer.cornerRadius  = 20;
    commitbtn.backgroundColor = CUSTOMCOLOR;
    [commitbtn addTarget:self action:@selector(commitClick:) forControlEvents:UIControlEventTouchUpInside];
    commitbtn.titleLabel.font =[UIFont systemFontOfSize:15];
    [commitbtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(20);
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.height.mas_equalTo(40);
    }];
    bottomView.backgroundColor =[UIColor whiteColor];
    self.tableView.tableFooterView= bottomView;
}
-(void)commitClick:(UIButton *)sender{
    NSLog(@"123");
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 4;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *headView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)];
    UILabel *titleLabel =[[UILabel alloc]init];
    [headView addSubview:titleLabel];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font =[UIFont systemFontOfSize:14];
    titleLabel.text = self.titleArry[section];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(100);
        make.height.mas_equalTo(20);
        make.centerX.mas_equalTo(headView.mas_centerX);
    }];
    headView.backgroundColor =[UIColor whiteColor];
    return headView;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 40;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    BusinessViewCell *cell =[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    //cell.textLabel.text = @"1233";
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 170;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
